package io.github.handyang.algorithms.base;

public class FixedCapacityStackOfStrings {
    private String[] a;

    /**
     * size
     */
    private int N;

    public FixedCapacityStackOfStrings(int cap) {
        a = new String[cap];
    }

    public boolean isEmpty() {
        return N == 0;
    }

    public int size() {
        return N;
    }

    public void push(String item) {
        a[N++] = item;
    }

    public String pop() {
        return a[--N];
    }

    /**
     * 1.3.1
     *
     * @return
     */
    public boolean isFull() {
        return N == a.length;
    }
}
